﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Wolfut.MirageEE.Domain.CommonUtilities
{
    public class Constant
    {
        public class AccountCategory
        {
            public const string AC1 = "现金";
            public const string AC2 = "银行存款";
            public const string AC3 = "费用";
        }
        public class ModuleName
        {
            public const string CurrecyCategoryText = "币别";
            public const String CodeRuleText = "编码规则信息";
            public const String ProjectText = "项目信息";
            public const string DepartmentText = "部门";

        }
        public class FormBusinessName
        {
            public const String CurrentCategory = "币别";
        }
        /// <summary>
        /// 存放数据字典的分类常量
        /// </summary>
        public class CodeRuleConst
        {
            private static Dictionary<String, String> CodeFlags = null;
            static CodeRuleConst()
            {
                CodeFlags = new Dictionary<string, string>();
                CodeFlags.Add(Constant.CodeRuleConst.CUSTOMER, "客户");
                CodeFlags.Add(Constant.CodeRuleConst.SUPPLIER, "供应商");
                CodeFlags.Add(Constant.CodeRuleConst.DEPARTMENT, "部门");
                CodeFlags.Add(Constant.CodeRuleConst.EMPLOYEE, "员工");
                CodeFlags.Add(Constant.CodeRuleConst.PROJECT, "项目");
                CodeFlags.Add(Constant.CodeRuleConst.PRODUCT, "商品");
                CodeFlags.Add(Constant.CodeRuleConst.EXPENSE_BILLS, "费用支出单");
                CodeFlags.Add(Constant.CodeRuleConst.PURCHASE_ORDERS, "采购订单");
                CodeFlags.Add(Constant.CodeRuleConst.PAYMENT_BILLS, "付款单");
                CodeFlags.Add(Constant.CodeRuleConst.PURCHASE_BILLS, "采购单");
                CodeFlags.Add(Constant.CodeRuleConst.PURCHASE_GOODS_RETURNED_ORDERS, "采购退货单");
                CodeFlags.Add(Constant.CodeRuleConst.OTHER_COLLECTING_BILLS, "其他应收单");
                CodeFlags.Add(Constant.CodeRuleConst.SALES_ORDERS, "销售订单");
                CodeFlags.Add(Constant.CodeRuleConst.COLLECTING_BILLS, "收款单");
                CodeFlags.Add(Constant.CodeRuleConst.SALES_BILLS, "销售单");
                CodeFlags.Add(Constant.CodeRuleConst.SALES_RETURN_BILLS, "销售退货单");
                CodeFlags.Add(Constant.CodeRuleConst.IN_WAREHOUSE_ORDERS, "其他入库单");
                CodeFlags.Add(Constant.CodeRuleConst.OUT_WAREHOUSE_ORDERS, "其他出库单");
                CodeFlags.Add(Constant.CodeRuleConst.WARE_TRANSFER_BILLS, "存货调拨单");
                CodeFlags.Add(Constant.CodeRuleConst.PRODUCT_TRANSFER_BILLS, "存货转换单");
                CodeFlags.Add(Constant.CodeRuleConst.PRODUCT_TRANSFER_BILLS_MODE, "存货转换单模板");
                CodeFlags.Add(Constant.CodeRuleConst.VOUCHER_NO, "凭证号");
            }

            #region 基础编码
            public static String GetCodeRuleFlagName(String codeFlag)
            {
                if (!CodeFlags.ContainsKey(codeFlag))
                {
                    return String.Empty;
                }
                return CodeFlags[codeFlag];
            }
            /// <summary>
            /// 供应商
            /// </summary>
            public const String SUPPLIER = "008_001";
            /// <summary>
            /// 客户
            /// </summary>
            public const String CUSTOMER = "008_002";
            /// <summary>
            /// 部门
            /// </summary>
            public const String DEPARTMENT = "008_003";
            /// <summary>
            /// 职员
            /// </summary>
            public const String EMPLOYEE = "008_004";
            /// <summary>
            /// 存货
            /// </summary>
            public const String PRODUCT = "008_005";
            /// <summary>
            /// 项目
            /// </summary>6
            public const String PROJECT = "008_006";
            #endregion

            #region 基础报表编码
            /// <summary>
            /// 费用支出单
            /// </summary>
            public const String EXPENSE_BILLS = "009_001";
            /// <summary>
            /// 采购订单
            /// </summary>
            public const String PURCHASE_ORDERS = "009_002";
            /// <summary>
            /// 付款单
            /// </summary>
            public const String PAYMENT_BILLS = "009_003";
            /// <summary>
            /// 采购单
            /// </summary>
            public const String PURCHASE_BILLS = "009_004";
            /// <summary>
            /// 采购退货单
            /// </summary>
            public const String PURCHASE_GOODS_RETURNED_ORDERS = "009_005";
            /// <summary>
            /// 其他应收单
            /// </summary>
            public const String OTHER_COLLECTING_BILLS = "009_006";
            /// <summary>
            /// 销售订单
            /// </summary>
            public const String SALES_ORDERS = "009_007";
            /// <summary>
            /// 收款单
            /// </summary>
            public const String COLLECTING_BILLS = "009_008";
            /// <summary>
            /// 销售单
            /// </summary>
            public const String SALES_BILLS = "009_009";

            /// <summary>
            /// 销售退货单
            /// </summary>
            public const String SALES_RETURN_BILLS = "009_010";

            /// <summary>
            /// 其他入库单
            /// </summary>
            public const String IN_WAREHOUSE_ORDERS = "009_011";

            /// <summary>
            /// 其他出库单
            /// </summary>
            public const String OUT_WAREHOUSE_ORDERS = "009_012";

            /// <summary>
            /// 存货调拨单
            /// </summary>
            public const String WARE_TRANSFER_BILLS = "009_013";

            /// <summary>
            /// 存货转换单
            /// </summary>
            public const String PRODUCT_TRANSFER_BILLS = "009_014";
            /// <summary>
            /// 存货转换单模板
            /// </summary>
            public const String PRODUCT_TRANSFER_BILLS_MODE = "009_015";

            /// <summary>
            /// 凭证号
            /// </summary>
            public const String VOUCHER_NO = "009_016";
            #endregion
        }

        /// <summary>
        /// 数据字典分类常量
        /// </summary>
        public class DataDictionaryCategory
        {
            private static Dictionary<String, String> DataCategory = null;
            static DataDictionaryCategory()
            {
                DataCategory = new Dictionary<string, string>();
                AddItem(SALE_ORDER_REMARK, "销售订单常用备注");
                AddItem(SALE_BILL_REMARK, "销售单常用备注");
                AddItem(SALE_COLLECTING_REMARK, "收款单常用备注");
                AddItem(SALES_RETURN_REMARK, "销售退货单常用备注");
                AddItem(SALE_EXPENSE_REMARK, "其他应收单常用备注");
                AddItem(COLLECTING_METHOD, "收款/付款方式");
                AddItem(COLLECTION_CONDITION, "收款/付款条件");
                AddItem(CUSTOMER_CATE, "客户类别");

                AddItem(AREA, "客户来源");
                AddItem(CUSTOMER_SOURCE, "地区");
                AddItem(INPUT_BILL_REMARK, "其他入库单常用备注");
                AddItem(OUTPUT_BILL_REMARK, "其他出库单常用备注");
                AddItem(PURCHASE_ORDER_REMARK, "采购订单常用备注");
                AddItem(PURCHASE_BILL_REMARK, "采购单常用备注");
                AddItem(ESHOP_CATE, "商品所属网店分类");
                AddItem(PAYBILL_REMARK, "付款单常用备注");
                AddItem(PURCHASE_RETURN, "采购退货单常用备注");
                AddItem(EXPENSE_BILL_REMARK, "费用支出单常用备注");
                AddItem(SUPPLIER_CATE, "供应商类别");
                AddItem(ACCOUNTING_REMARK, "凭证单常用备注");
                AddItem(BUSINESS, "行业");
            }

            public static void AddItem(String key, String value)
            {
                if ((DataCategory.ContainsKey(key))||(DataCategory.ContainsValue(value)))
                {
                    return;
                }
                DataCategory.Add(key,value);
            }
            public static List<String> CategoryNameList
            {
                get
                {
                    List<String> list=new List<String>();
                    foreach(KeyValuePair<String,String> item in DataCategory)
                    {
                        list.Add(item.Value);
                    }
                    return list;
                }
            }

            #region 销售模块
            public static String GetCateName(String categoryCode)
            {
                if (!DataCategory.ContainsKey(categoryCode))
                {
                    return String.Empty;
                }
                return DataCategory[categoryCode];
            }

            public static String GetCateCode(String categoryName)
            {
                if (!DataCategory.ContainsValue(categoryName))
                {
                    return String.Empty;
                }
                foreach (KeyValuePair<String, String> item in DataCategory)
                {
                    if (item.Value == categoryName)
                    {
                        return item.Key;
                    }
                }
                return String.Empty;
            }

            /// <summary>
            /// 销售订单常用备注
            /// </summary>
            public const String SALE_ORDER_REMARK = "sale_001";
            /// <summary>
            /// 销售单常用备注
            /// </summary>
            public const String SALE_BILL_REMARK = "sale_002";
            /// <summary>
            /// 收款单常用备注
            /// </summary>
            public const String SALE_COLLECTING_REMARK = "sale_003";
            /// <summary>
            /// 销售退货单常用备注
            /// </summary>
            public const String SALES_RETURN_REMARK = "sale_004";
            /// <summary>
            /// 其他应收单常用备注
            /// </summary>
            public const String SALE_EXPENSE_REMARK = "sale_005";
            #endregion

            /// <summary>
            /// 行业
            /// </summary>
            public const String BUSINESS = "business_001";

            /// <summary>
            /// 收款/付款方式	
            /// </summary>
            public const String COLLECTING_METHOD = "collect_001";

            /// <summary>
            /// 收款/付款条件
            /// </summary>
            public const String COLLECTION_CONDITION = "collect_002";

            /// <summary>
            /// 客户类别
            /// </summary>
            public const String CUSTOMER_CATE = "customer_001";

            
            /// <summary>
            /// 客户来源
            /// </summary>
            public const String CUSTOMER_SOURCE = "customer_002";

            /// <summary>
            /// 地区
            /// </summary>
            public const String AREA = "area_001";

            /// <summary>
            /// 其他入库单常用备注
            /// </summary>
            public const String INPUT_BILL_REMARK="warehouse_001";
            /// <summary>
            /// 其他出库单常用备注
            /// </summary>
            public const String OUTPUT_BILL_REMARK="warehouse_002";
            /// <summary>
            /// 采购订单常用备注
            /// </summary>
            public const String PURCHASE_ORDER_REMARK="purchase_001";
            /// <summary>
            /// 采购单常用备注
            /// </summary>
            public const String PURCHASE_BILL_REMARK="purchase_002";
            /// <summary>
            /// 商品所属网店分类
            /// </summary>
            public const String ESHOP_CATE="eshop_001";

            /// <summary>
            /// 付款单常用备注
            /// </summary>
            public const String PAYBILL_REMARK="purchase_003";

            /// <summary>
            /// 采购退货单常用备注
            /// </summary>
            public const String PURCHASE_RETURN="purchase_004";
            /// <summary>
            /// 费用支出单常用备注
            /// </summary>
            public const String EXPENSE_BILL_REMARK="purchase_005";

            /// <summary>
            /// 供应商类别
            /// </summary>
            public const String SUPPLIER_CATE="purchase_006";

            /// <summary>
            /// 凭证单常用备注
            /// </summary>
            public const String ACCOUNTING_REMARK="Accounting_001";
        }
        public class DateTimeFormat
        {
            public const string CustomerizeDate = "yyyyMMdd";
            public static DateTime DATETIME_MIN_VALUE = new DateTime(1900, 1, 1);
            public static DateTime DATETIME_MAX_VALUE = new DateTime(2079, 6, 6);

            public const string MirageEE_FORMAT_CURRENCY = "###,##0.00#######";
            public const string MirageEE_FORMAT_SHORT_DATE = "dd/MM/yyyy";
            public const string MirageEE_FORMAT_LONG_DATE = "dd/MM/yyyy";

            public const string MirageEE_FORMAT_SHORT_TIME = "HH:mm:ss";
            public const string MirageEE_FORMAT_LONG_TIME = "HH:mm:ss";

            public const string MirageEE_FORMAT_MONTH_DATE = "dd MMM yyyy";
            public const string MirageEE_FORMAT_DATE_TIME = "dd/MM/yyyy HH:mm:ss";
            public const string MirageEE_FORMAT_DATE_TIME_FILENAME = "ddMMyyyy-HHmmss";
            public const string MirageEE_FORMAT_DATE_TIME_SCHEDULE = "dd/MM/yyyy dddd";
            public const string MirageEE_FORMAT_DATE_TIME_WORKEXP = "M/yyyy";
            public const string MirageEE_FORMAT_DATE_TIME_NO_SECONDS = "dd/MM/yyyy HH:mm";
            public const string MirageEE_FORMAT_DATE_TIME_NO_SECONDSTB = "yyyy/MM/dd HH:mm";
            public const string MirageEE_FORMAT_DATE_TIME_12H = "dd/MM/yyyy hh:mm:ss tt";
            public const string MirageEE_FORMAT_DATE_TIME_12H_NO_SECONDS = "dd/MM/yyyy hh:mm tt";
        }
        public class RegularExpressions
        {

            public const string MirageEE_REGEX_POSTAL_CODE = @"^\d{6}$";
            public const string MirageEE_REGEX_TELEPHONE = @"^[6]{1}\d{7}$";
            public const string MirageEE_REGEX_MOBILEPHONE = @"^[8-9]{1}\d{7}$";
            public const string MirageEE_REGEX_PAGER_NUMBER = @"^[8-9]{1}\d{7}";
            public const string MirageEE_REGEX_EMAIL = @"^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$";
        }
        public class Message
        {
            public const string MessageFileName = "MirageEE.Messages.config";


        }
        public class MirageEEImages
        {
            public static string PERINTPRIVEW = "Print Preview.png";
            public static string listing_copy = "Listing.listing_copy.png";

            public static string bg_png = "WinUI.bg.png";
            public static string abacus_ico="abacus.ico";
        }
        public class UIRelectionConstant
        {

            public const string UIAssembly = "Wolfut.MirageEE.UI";
            public const string UICategory = ".UI";
            public const string InterfaceAssembly = "Wolfut.MirageEE.Interface";
            public const string ServerAssembly = "Wolfut.MirageEE.Server";
            public const string ServerCategory = ".Server";
            public const string Common = ".Common";
            public const string Procurement = ".Procurement";
            public const string Products = ".Products";
            public const string Sales = ".Sales";

        }

        public class FontName
        {
           public static string Microsoft_Sans_Serif =  "Microsoft Sans Serif";

        }
       
        public enum ExportPrintOptions
        {
            EXPORT_TO_HTML = 0,
            EXPORT_TO_XML = 1,
            EXPORT_TO_EXCEL = 2,
            EXPORT_TO_TEXT = 3,
            EXPORT_TO_PDF=4,
            PRINT = 5
        }
        public enum PictureType
        {
            JPG = 0,
            JPEG,
            BMP,
            GIF,
            PNG,
            TIFF
        }
        public enum FormState
        {
            Unchanged,
            FORMADD,
            FORMUPDATED,
            FORMSAVED,
            FORMITEMCOPY,
        }
        public enum RenderType
        {
            WIN = 0,
            WEB
        }
        public static string[] provinces = { "北京市", "天津市", "上海市", "重庆市", "河北省", "山西省", "内蒙古自治区", "黑龙江省", "吉林省", "辽宁省", "江苏省", "浙江省", "安徽省", "福建省", "江西省", "山东省", "河南省", "湖北省", "湖南省", "广东省", "广西省", "海南省", "四川省", "贵州省", "云南省", "陕西省", "宁夏自治区", "青海省", "甘肃省", "新疆自治区", "西藏自治区", "台湾省", "香港特别行政区", "澳门特别行政区" };
        public static string[] orderStatus = { "新订单", "已确认", "已收款", "已发货", "已完成", "订单作废", "所有订单" };
        public static string[] marriageInfo = { "未知", "是", "否" };
        public static string[] genderInfo = { "未知", "男", "女" };
        public static string[] storeTypeInfo = { "淘宝", "易趣", "拍拍", "其它" };//, "拍拍" 
        public const string SysCode = "ESHOP";
        public const string SysTrueCode = "是";
        public const string SysTrueValue = "Y";

        public const string SysFalseCode = "否";
        public const string SysFalseValue = "N";

        public const string SysHasYesCode = "有";
        public const string SysHasNoCode = "无";

        public const string Activated = "已激活";
        public const string NoActivated = "未激活";

        public const string Close = "关闭";
        public const string Cancal = "取消";

        public const int decimalNumber = 2;//小数位
        public const string AssemblyName = "Wolfut.MirageEE.UI.UI.Images.";      
        public const float FontSize = 8.25F;        //FormSateText
        public const string FormAddText = "{0}：新增";
        public const string FormModifyText = "{0}：修改";


    }
}
